<script setup lang="ts">
import { reactive, ref, watch } from "vue";

const user = reactive({
  name: "tom",
  info: {
    gender: "男",
    age: 18,
  },
});

watch(() => user.info.age, () => {
  console.log("侦听到了");
});

// watch(() => user.info, () => {
//   console.log("侦听到了");
// },{deep:true})

// watch(user.info, () => {
//   console.log("侦听到了");
// });
</script>

<template>
  <p>{{ user }}</p>
  <button @click="user.name = '李思'">点击改名</button>
  <button @click="user.info.age++">点击年龄+1</button>
</template>
